import { getDisplayBlogsApi} from '@/api/blog'
export default{
    namespaced:true,
    state:{
        blogs:'',
        vipblogs:'',
        total:0
    },
    actions:{
        // 请求博客
        async vuexGetBlogs(content,data){
            const res = await getDisplayBlogsApi(data)
            if(res.data.code == 1000){
                content.commit('SETBLOG',res.data.blogs)
                content.commit('SETTOTAL',res.data.total)
            }
        },
        async vuexGetVipBlogs(content,data){
            const res = await getDisplayBlogsApi(data)
            if(res.data.code == 1000){
                content.commit('SETVIPBLOG',res.data.blogs)
            }
        }
    },
    mutations:{
        // 精选博客
        SETVIPBLOG(state,data){
            state.vipblogs = data
        },
        // 博客信息存进state
        SETBLOG(state,data){
            state.blogs = data
        },
        SETTOTAL(state,data){
            state.total = data
        }
    },
    getters:{

    }
}